package chp10.dog;

public class DogToy {

    //健康值
    int health;

    String name;

    public void show(){
        System.out.println("电子宠物 "+name+" 健康值:"+health);
    }

    public void play(){
        System.out.println("玩耍了一下，健康值提高了5");
        health += 5;
    }

    public void eat(){
        System.out.println("吃了大餐，健康值提高了10");
        health += 10;
    }

    public void wash(){
        System.out.println("洗了澡，健康值提高了2");
        health += 2;
    }

    //吃了不干净的东西
    public void eatDirty(){
        System.out.println("吃了不干净的东西，健康值减20");
        health -= 20;
    }
}
